package com.qubuyer.core.app

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import com.qubuyer.core.framework.BaseViewModel

/**
 * Author: wujf
 * Time: 2020/5/25
 * Description:
 * * 应用模块:fragment
 * *
 *
 *
 * * 类描述: 基类fragment
 * *Login
 *
 *
 */
abstract class MVVMFragment<V : ViewDataBinding, VM : BaseViewModel> : VMFragment<VM>() {
    protected lateinit var viewDataBinding: V

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        super.onCreateView(inflater, container, savedInstanceState)
        viewDataBinding = DataBindingUtil.bind<V>(mRoot) as V
        viewDataBinding.lifecycleOwner = this
        onDataBinding(viewDataBinding)
        return viewDataBinding.root
    }

    protected abstract fun onDataBinding(dataBinding: V)
}